Edit Custom JavaScript
You can view and edit custom JavaScript within Form Studio, using the built-in Script Editor, or using an external text editor, such as Notepad++.
Each form has its own Script file, which stores all the custom JavaScript functions for Events, Datasource error handling and data validation purposes for that form. This means that you can edit any of the custom JavaScript, whether it is a predefined action, validation or custom function, no matter where you load the file from. It also means that you can use the same function for multiple Elements, e.g. where you want two Elements on a form to have the same validation criteria applied, you could assign the same JavaScript function to them both, providing the script works as required in both situations.
- JavaScript expressions entered in the Visible and Disabled Properties for an Element are not stored in the Script file and are edited in the Expression Builder pop-up dialog available from an Element's Appearance properties.
The built-in Script Editor can be loaded from within an Element's Events or Rules properties or from the Projects tab in the Project Explorer Pane. The Script Editor runs in the Studio's Form Design workspace.
You can edit the Script file using an external editor from the Projects tab in the Project Explorer Pane or by directly loading the file within the editor itself.
- You can only edit the Script file in one editor at once, you can't edit it in both the built-in Script Editor and an external editor at the same time.
You can clear the value in any of the Element properties from the right-click context-sensitive menu. In the case of Event and Validation properties, clearing the property doesn't delete the JavaScript from the Script file, so it is still available for use elsewhere. If you want to delete it, you will need to open the Script file and manually delete the function from the file.
You must save your project, in order to save changes made to your custom JavaScript. If you close the project without saving, changes made to the custom JavaScript will be lost.
See also:
Customise Forms with JavaScript